<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/global.css" media="all">
  <style>
	  .layui-form{min-width:800px;}
	  .layui-form-label{ width:20%;}
	  .layui-form-label span{ font-size: 12px; color:gray;}
	  .layui-form-item .layui-input-inline{width: 70%;}
	  .layui-table td, .layui-table th{ text-align: center;}
	  .span10{ width: 100px; height: 22px; line-height: 22px; padding: 2px;}
	  .thischeck_all{ text-decoration: underline; cursor: pointer;}
  </style>
</head>
<body>

<form action="{:url()}" method="post" class="layui-form" lay-filter="component-form-group" onsubmit="return save_form2(this)">
	<input type="hidden" name="table_id" value="{$table_id}" />
  <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">模型名称</label>
      <div class="layui-input-inline">
        <input type="text" name="name" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">是否启用</label>
      <div class="layui-input-inline">
            <div class="layui-col-md12">
              <input type="radio" name="status" value="1" checked="true" title="启用"/>
              <input type="radio" name="status" value="0" title="禁用"/>
            </div>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">自动审核<span><br>(开启自动审核后添加信息直接审核)</span></label>
      <div class="layui-input-inline">
            <div class="layui-col-md12">
              <input type="radio" name="autochecked" value="1" checked="true" title="开启"/>
              <input type="radio" name="autochecked" value="0" title="关闭"/>
            </div>
      </div>
    </div>
	
    <div class="layui-form-item">
      <label class="layui-form-label">开启投稿</label>
      <div class="layui-input-inline">
            <div class="layui-col-md12">
              <input type="radio" name="contribute" value="1" checked="true" title="开启"/>
              <input type="radio" name="contribute" value="0" title="关闭"/>
            </div>
      </div>
    </div>	
    <div class="layui-form-item">
      <label class="layui-form-label">表单类型</label>
      <div class="layui-input-inline">


		<div class="widget-content nopadding" style="width:99%; ">
		  <table class="layui-table" style="border-right:1px solid #ccc">
			<thead>
			  <tr>
				<th width="10%;">字段标识</th>
				<th width="10%;">字段名</th>
				<th class="thischeck_all" val="1" objname="is_enter">录入项</th>
				<th class="thischeck_all" val="1" objname="is_contribute">投稿项</th>
				<th class="thischeck_all" val="1" objname="must_enter">必填项</th>
				<th class="thischeck_all" val="1" objname="is_list">列表模板</th>
				<th class="thischeck_all" val="1" objname="is_search">搜索项</th>
				<th class="thischeck_all" val="1" objname="is_sort">排序项</th>
			  </tr>
			</thead>
			<tbody>
				{foreach $table_field as $v}
			  <tr>
				  <td><input type="hidden" name="field_id[]" value="{$v.field_id}"><input type="text" name="field_name[]" value="{$v.name}" class="span10"></td>
				  <td><input type="text" name="field[]" value="{$v.field}" readonly  class="span10"></td>
				  <td class="center"><input type="checkbox" lay-skin="primary" name="is_enter[]" value="{$v.field}"></td>
				  <td class="center"><input type="checkbox" lay-skin="primary" name="is_contribute[]" value="{$v.field}"></td>
				  <td class="center"><input type="checkbox" lay-skin="primary" name="must_enter[]" value="{$v.field}"></td>
				  <?php
				  if($v['issystem']){
				  ?>
				  <td class="center"><input type="checkbox" lay-skin="primary" name="is_list[]" value="{$v.field}" {$v['issystem']?"":"disabled"}></td>
				  <td class="center"><input type="checkbox" lay-skin="primary" name="is_search[]" value="{$v.field}" {$v['issystem']?"":"disabled"}></td>
				  <td class="center"><input type="checkbox" lay-skin="primary" name="is_sort[]" value="{$v.field}" {$v['issystem']?"":"disabled"}></td>
				  <?php
				  }else{
				  ?>
				  <td class="center">-</td>
				  <td class="center">-</td>
				  <td class="center">-</td>
				  <?php
				  }
				  ?>                                              

			  </tr> 
				{/foreach}

			</tbody>
		  </table>
		</div>


      </div>
    </div>	
		
    <div class="layui-form-item">
      <label class="layui-form-label">自定义操作模板</label>
      <div class="layui-input-inline">
			您可以在"app/admin/view/info/"下面自定义后台列表模板/添加信息模板/修改信息模板文件<br>
			列表模板：app/admin/view/info/model_{模型ID}/index.html<br>
			添加信息模板：app/admin/view/info/model_{模型ID}/add.html<br>
			修改信息模板：app/admin/view/info/model_{模型ID}/update.html<br>
			程序会自动判断以上模板文件是否存在，如不存在会调用公共模板（app/admin/view/info/下的index.html,add.html,update.html）文件
      </div>
    </div>	
				

  </div>
  
	<div class="layui-form-item layui-layout-admin" style="margin-top: 30px;">
		<div class="layui-input-block">
		   <div class="layui-footer" style="left: 0;">
			  <button class="layui-btn" type="submit"  lay-filter="component-form-element">立即提交</button>
			  <button type="reset" class="layui-btn layui-btn-primary close">关闭</button>
		  </div>
		</div>
	</div>  
</form>
  <script src="/static/admin/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>    
  <script src="/static/js/globals.js"></script>  
  <script>
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,form = layui.form;
	form.render(null, 'component-form-group');
	//模型里选择字段
	$(function(){
	    $(".thischeck_all").click(function(){
	        var y=$(this).attr("val");
	        var objname=$(this).attr("objname");
	        if(y==0){
				$("input[name='"+objname+"[]']").prop("checked", false)
	            y=1;
	        }else if(y==1){
				$("input[name='"+objname+"[]']").prop("checked", true)
	            y=0;
	        }
			form.render(null, 'component-form-group');
	        $(this).attr("val",y);
	    })
	})
  })
  

  </script>
</body>
</html>